import { AppContext } from '@/pages/App/context'
import { useContext, useEffect, useState } from 'react'
import { defaultHomeData } from '../context'
import { systemInfo } from '../interface'
const useIndexHook = () => {
	const AppData = useContext(AppContext)
	const system = AppData.system
	/********************************参数定义****start******************************/
	const [homeData, setHomeData] = useState<systemInfo>(defaultHomeData)
	const version = system.appVersion || ''

	useEffect(() => {
		setHomeData({
			...homeData,
			version: version,
		})
	}, [system])
	return {
		homeData,
		setHomeData,
	}
}

export default useIndexHook
